import 'package:fluent_ui/fluent_ui.dart';

import 'package:flutter_animator/flutter_animator.dart';
import 'package:get/get.dart';
import 'package:jm_flutter/jm_flutter.dart';

import '../../resources/resources.dart';
import '../my_text.dart';

class MyFieldDialog extends StatelessWidget {
   MyFieldDialog({
    Key? key,
    this.title,
    this.initValue,
  }) : super(key: key);



  final String? title;
  final String? initValue;


  String _newValue = "";

  @override
  Widget build(BuildContext context) {
    return ContentDialog(

      title: Text(title??""),
      content: TextBox(
        controller: initValue != null && initValue!.isNotEmpty ? TextEditingController(text: initValue) : null,
        onChanged: (str){
          _newValue = str;
        },
      ),
      actions: [
        Button(
            child: const Text('取消'),
            onPressed: () {
              back();
            }
        ),
        Button(
            child: const Text('确认'),
            onPressed: () {
              back(result: _newValue);
            }
        )
      ],
    );
  }

}
